1. Field of the Invention
The present invention relates generally to a computer implemented method, data processing system, and computer program product for executing two or more processes concurrently in a data processing system. More specifically, the present invention relates to thread control by a shell process.
2. Description of the Related Art
Most modern computers provide a command line to access operating system commands. In UNIX and POSIX-based operating systems, the command line interface is called a shell. Sometimes the shell is called a command interpreter. As the outer layer of the operating system, the shell cooperates with the kernel, the operating system's inmost layer or core of services.
The shell may operate in an interactive mode that permits a user to edit commands and even write small sequences of steps that command the operating system to process data. In addition, the shell may operate in an automatic mode. The automatic mode permits the shell to execute scripts of multiple commands that may be stored as a file.
Occasionally, a user may require a script or other shell command to execute over a lengthy duration. For example, the UNIX ‘tail’ command may be used to continuously update the latest lines added to a log. Since a user may run the ‘tail’ command for a period while the user continues to interact with a shell, the user can operate the ‘tail’ command in the background. Background processing of UNIX commands permits some parallel execution of the background process along with any foreground interaction with the shell. Data processing systems accomplish this parallelism by creating a second process in response to commands entered that include a reserved character, that is ‘&’, as the final character in the command.
Creating the second process, however, is not without costs. Initially, the operating system locates and executes any configuration files, for example, ‘/etc/profile’ among others. Secondly, the operating system allocates and loads memory with values for common environment variables, such as, $HOME or $ENV. Thirdly, the operating system sets up memory and routines to handle inter process communications with the newly opened process. Such inter process communications include facilities to handle shared memory, synchronization, message passing and remote procedure calls. Many background processes do not require such extensive services, particularly those processes that require no coordination with concurrent processes.
Thus, a need exists to both permit the parallel execution of a script or other program at the command line without causing the performance and memory overhead of creating a new process, as well as respond to a command line syntax that expressly indicates that a parallel execution is requested. New process creation can cause redundant establishment of environment variables. In addition, a benefit would accrue if shell built-in functionality avoided spawning an additional process.